<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE composition PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns:ui="http://java.sun.com/jsf/facelets"
                template="/resources/template/template.xhtml"
                xmlns:p="http://primefaces.org/ui"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:ch="http://java.sun.com/jsf/composite/channel"
                xmlns:pe="http://primefaces.org/ui/extensions">

    <ui:define name="content">

        <h:form>

            <p:panel header="Statement Of Agent Account Total And Count">
                <f:facet name="header">
                    <p:outputLabel value="Agent Wise Appoinment Totals And Count" />
                    <p:commandButton id="btnBack" value="Back" 
                                     action="/channel/channel_reports" style="float: right;"
                                     ajax="false">
                    </p:commandButton>
                </f:facet>

                <p:panel>
                    <h:panelGrid columns="2" id="pan1" >
                        <h:outputLabel value="From Date"/>
                        <p:calendar value="#{channelReportTempController.fromDate}" navigator="true" pattern="dd MMM yyyy hh:mm:ss a"  >
                        </p:calendar>
                        <h:outputLabel value="To Date"/>
                        <p:calendar value="#{channelReportTempController.toDate}" navigator="true" pattern="dd MMM yyyy hh:mm:ss a" >
                        </p:calendar>
                        <h:outputLabel value="By Session Date"/> 
                        <p:selectBooleanCheckbox value="#{channelReportTempController.sessoinDate}" />
                        <h:outputLabel value="Doc Fee Only"/> 
                        <p:selectBooleanCheckbox value="#{channelReportTempController.withDocPayment}" >
                            <p:ajax event="change" process="@this" update="pan1" listener="#{channelReportTempController.listnerDoc()}" />
                        </p:selectBooleanCheckbox>
                        <h:outputLabel value="Hos fee Only"/> 
                        <p:selectBooleanCheckbox value="#{channelReportTempController.withOutDocPayment}" >
                            <p:ajax event="change" process="@this" update="pan1" listener="#{channelReportTempController.listnerHos()}" />
                        </p:selectBooleanCheckbox>
                        <h:outputLabel styleClass="noPrintButton" value="User Name"/>
                        <p:autoComplete converter="webUs" completeMethod="#{webUserController.completeUser}" styleClass="noPrintButton"
                                        forceSelection="true"
                                        var="w" itemLabel="#{w.webUserPerson.name}" itemValue="#{w}"
                                        value="#{channelReportTempController.reportKeyWord.webUser}" ></p:autoComplete>
                        <p:outputLabel value="Channel Type" rendered="#{sessionController.loggedPreference.applicationInstitution eq 'Cooperative'}" />
                        <p:selectOneMenu id="cmbChanType" value="#{channelReportTempController.reportKeyWord.billType}" rendered="#{sessionController.loggedPreference.applicationInstitution eq 'Cooperative'}" >
                            <f:selectItem itemLabel="Please Select a Type"/>
                            <f:selectItems value="#{enumController.channelType}" var="t" itemLabel="#{t.label}" itemValue="#{t}" />    
                        </p:selectOneMenu>
                    </h:panelGrid> 
                    <h:panelGrid columns="3">
                        <p:commandButton action="#{channelReportTempController.createUsercollectionByDate()}" value="Process" ajax="false" />
                        <p:commandButton ajax="false" value="Print" styleClass="noPrintButton">
                            <p:printer target="reportPrint"  />
                        </p:commandButton>
                        <p:commandButton actionListener="#{channelReportTempController.createUsercollectionByDate()}" ajax="false" value="Excel" styleClass="noPrintButton" style="float: right;" >
                            <pe:exporter type="xlsx" target="tbl1" fileName="channel_report_cashier_summery_date"  />
                        </p:commandButton>
                    </h:panelGrid> 
                </p:panel>
                <p:panel id="reportPrint" styleClass="noBorder summeryBorder">
                    <p:dataTable value="#{channelReportTempController.channelDateDetailRows}" var="a" id="tbl1" >
                        <f:facet name="header">
                            <p:outputLabel value="#{sessionController.loggedUser.institution.name}" />
                            <br></br>
                            <p:outputLabel value="All Booking Summery  - " />
                            <p:outputLabel value="Cashier : #{channelReportTempController.reportKeyWord.webUser.webUserPerson.name}"/>
                            <br></br>
                            <p:outputLabel value="From : " />
                            <p:outputLabel value="#{channelReportTempController.fromDate}" >
                                <f:convertDateTime pattern="yyyy MMMM dd hh:mm:ss a" />
                            </p:outputLabel>
                            <p:outputLabel value="  To : " />
                            <p:outputLabel value="#{channelReportTempController.toDate}" >
                                <f:convertDateTime pattern="yyyy MMMM dd hh:mm:ss a" />
                            </p:outputLabel>
                        </f:facet>

                        <p:column>
                            <f:facet name="header">
                                <p:outputLabel value="Date" />
                            </f:facet>
                            <p:outputLabel value="#{a.date}" >
                            </p:outputLabel>
                            <f:facet name="footer">
                                <p:outputLabel value="Total" />
                            </f:facet>
                        </p:column>
                        <p:column styleClass="numberCol">
                            <f:facet name="header">
                                <p:outputLabel value="Cash" />
                            </f:facet>
                            <p:outputLabel value="#{a.cash}" >
                                <f:convertNumber pattern="##,##,##0.00" />
                            </p:outputLabel>
                            <f:facet name="footer">
                                <p:outputLabel value="#{channelReportTempController.channelTotal.cashTotal}" style="float: right" >
                                    <f:convertNumber pattern="##,##,##0.00" />
                                </p:outputLabel>
                            </f:facet>
                        </p:column>
                        <p:column styleClass="numberCol">
                            <f:facet name="header">
                                <p:outputLabel value="On-Call" />
                            </f:facet>
                            <p:outputLabel value="#{a.onCall}" >
                                <f:convertNumber pattern="##,##,##0.00" />
                            </p:outputLabel>
                            <f:facet name="footer">
                                <p:outputLabel value="#{channelReportTempController.channelTotal.onCallTotal}"  style="float: right">
                                    <f:convertNumber pattern="##,##,##0.00" />
                                </p:outputLabel>
                            </f:facet>
                        </p:column>
                        <p:column styleClass="numberCol">
                            <f:facet name="header">
                                <p:outputLabel value="Agent" />
                            </f:facet>
                            <p:outputLabel value="#{a.agent}" >
                                <f:convertNumber pattern="##,##,##0.00" />
                            </p:outputLabel>
                            <f:facet name="footer">
                                <p:outputLabel value="#{channelReportTempController.channelTotal.agentTotal}"  style="float: right">
                                    <f:convertNumber pattern="##,##,##0.00" />
                                </p:outputLabel>
                            </f:facet>
                        </p:column>
                        <p:column styleClass="numberCol">
                            <f:facet name="header">
                                <p:outputLabel value="Staff" />
                            </f:facet>
                            <p:outputLabel value="#{a.staff}" >
                                <f:convertNumber pattern="##,##,##0.00" />
                            </p:outputLabel>
                            <f:facet name="footer">
                                <p:outputLabel value="#{channelReportTempController.channelTotal.staffTotal}"  style="float: right">
                                    <f:convertNumber pattern="##,##,##0.00" />
                                </p:outputLabel>
                            </f:facet>
                        </p:column>
                        <p:column styleClass="numberCol">
                            <f:facet name="header">
                                <p:outputLabel value="Card" />
                            </f:facet>
                            <p:outputLabel value="#{a.card}" >
                                <f:convertNumber pattern="##,##,##0.00" />
                            </p:outputLabel>
                            <f:facet name="footer">
                                <p:outputLabel value="#{channelReportTempController.channelTotal.cardTotal}"  style="float: right">
                                    <f:convertNumber pattern="##,##,##0.00" />
                                </p:outputLabel>
                            </f:facet>
                        </p:column>
                        <p:column styleClass="numberCol">
                            <f:facet name="header">
                                <p:outputLabel value="Cheque" />
                            </f:facet>
                            <p:outputLabel value="#{a.cheque}" >
                                <f:convertNumber pattern="##,##,##0.00" />
                            </p:outputLabel>
                            <f:facet name="footer">
                                <p:outputLabel value="#{channelReportTempController.channelTotal.chequeTotal}"  style="float: right">
                                    <f:convertNumber pattern="##,##,##0.00" />
                                </p:outputLabel>
                            </f:facet>
                        </p:column>
                        <p:column styleClass="numberCol">
                            <f:facet name="header">
                                <p:outputLabel value="Slip" />
                            </f:facet>
                            <p:outputLabel value="#{a.slip}" >
                                <f:convertNumber pattern="##,##,##0.00" />
                            </p:outputLabel>
                            <f:facet name="footer">
                                <p:outputLabel value="#{channelReportTempController.channelTotal.slipTotal}"  style="float: right">
                                    <f:convertNumber pattern="##,##,##0.00" />
                                </p:outputLabel>
                            </f:facet>
                        </p:column>
                        <p:column styleClass="numberCol">
                            <f:facet name="header">
                                <p:outputLabel value="Total" />
                            </f:facet>
                            <p:outputLabel value="#{a.cash+a.onCall+a.agent+a.staff+a.card+a.cheque+a.slip}"  style="float: right">
                                <f:convertNumber pattern="##,##,##0.00" />
                            </p:outputLabel>
                            <f:facet name="footer">
                                <p:outputLabel value="#{channelReportTempController.channelTotal.agentTotal
                                                        +channelReportTempController.channelTotal.cardTotal
                                                        +channelReportTempController.channelTotal.cashTotal
                                                        +channelReportTempController.channelTotal.chequeTotal
                                                        +channelReportTempController.channelTotal.onCallTotal
                                                        +channelReportTempController.channelTotal.slipTotal
                                                        +channelReportTempController.channelTotal.staffTotal}"  style="float: right">
                                    <f:convertNumber pattern="##,##,##0.00" />
                                </p:outputLabel>
                            </f:facet>
                        </p:column>
                    </p:dataTable>
                </p:panel>

            </p:panel>

        </h:form>
    </ui:define>


</ui:composition>